<template>
  <IcpPage>
    <AntdDesignForm
      :is-add="form.isAdd"
      :form-id="form.formId"
      :form-business-level="form.formBusinessLevel"
      :belong-business-id="form.belongBusinessId"
      @after-submit="afterSubmit()"
    />
  </IcpPage>
</template>
<script lang="ts" setup name="">
import AntdDesignForm from './components/AntdDesignForm.vue'
import { useRoute, useRouter } from 'vue-router'
import { ref } from 'vue'
import { isConfig } from '@@/utils/index'

const route = useRoute()

const router = useRouter()

const form = ref<any>({
  isAdd: route.query.id ? false : true,
  formId: route.query.id ? route.query.id : '',
  formBusinessLevel: isConfig() ? 1 : 2,
  belongBusinessId: '0'
})

const afterSubmit = () => {
  const path = isConfig() ? 'configure' : 'sop'
  router.push({ path: `/${path}/form/index` })
}
</script>
